﻿package 
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author Jonghwa Kim
	 */
	public class GUI_Combo extends MovieClip 
	{
		
		private const ComboBonusStr = ["1.0", "1.2", "1.5", "2.0", "2.2", "2.4", "2.6", "2.8", "3.0", "3.2", "3.4", "3.6", "3.8", "4.0", "4.2", "4.4", "4.6", "4.8", "4.9", "5.0"];
		public function GUI_Combo():void {
			
			addEventListener(Event.ADDED_TO_STAGE, Init);
			
			
		}
		
		private function Init(e:Event) {
			removeEventListener(Event.ADDED_TO_STAGE, Init);
			
			gotoAndStop(1);
			addEventListener(Event.ENTER_FRAME, setText);
		}
		
		public function setText(e:Event):void {
			if (BlockMap.currentCombo == 0 || BlockMap.currentCombo == 1) {
				this.gotoAndStop(1);
			}else {
				if (currentFrame != 15) play();
				
			}
			
			
			
			
			if (_combo) _combo.text = "COMBO " + BlockMap.currentCombo;
			
			var comboFix = BlockMap.currentCombo;
			if (BlockMap.currentCombo >= ComboBonusStr.length) {
				
				comboFix = ComboBonusStr.length - 1;
				
			}
			
			if (_combo2) _combo2.text = "(X" + ComboBonusStr[comboFix] + ")";
			
		}
		
		
		
	}
	
}